﻿<UserControl x:Class="Reactor.MiniManager.Views.BusDiagnosticsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:ViewModels="clr-namespace:Reactor.MiniManager.ViewModels" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="EndpointTemplate" DataType="{x:Type ViewModels:EndpointDestinationViewModel}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0" Text="{Binding Mode=OneTime, Path=Name}" FontWeight="Bold" />
                    <ItemsControl Grid.Row="1" ItemsSource="{Binding MessageTypeNames}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Margin="20,2,2,2" Text="{Binding}" />
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <StackPanel>
        <TextBlock Text="Local endpoint destinations and messages expected at each destination" Margin="10" />
        <GroupBox Header="Queues" Margin="5" Padding="5">
            <ItemsControl ItemsSource="{Binding QueueEndpoints}" ItemTemplate="{StaticResource EndpointTemplate}">
            </ItemsControl>
        </GroupBox>

        <GroupBox Header="Topics" Margin="5,10,5,5" Padding="5">
            <ItemsControl ItemsSource="{Binding TopicEndpoints}" ItemTemplate="{StaticResource EndpointTemplate}">
            </ItemsControl>
        </GroupBox>
    </StackPanel>
</UserControl>
